const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
const path = require("path");
const config = {
  entry: "./src/index.js",
  output: { clean: true },
  module: {
    rules: [
      {
        test: require.resolve("./src/index.js"),
        use: "imports-loader?wrapper=window",
      },
      {
        test: require.resolve("./src/global.js"),
        use: "exports-loader?type=commonjs&exports=file,multiple|obj.parse|parse,multiple|obj.ok|ok",
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin(),
    new webpack.ProvidePlugin({
      join: ["lodash", "join"],
    }),
  ],
};
if (process.env.NODE_ENV === "development") {
  config.devtool = "inline-source-map";
}
module.exports = config;
